package com.example.common.extend

import android.content.SharedPreferences

inline fun SharedPreferences.edit(
    commit: Boolean = false,
    action: SharedPreferences.Editor.() -> Unit
) {
    val editor=edit()
    action(editor)
    if (commit) {
        editor.commit()
    }else{
        editor.apply()
    }
}